// tsc 需要加上 --target es5 参数，否则编译报错：
// error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
// tsc -t es5 index.ts && node index.js

class XiaoJieJie {
    constructor(private _age: number) {
    }

    get age(): number {
        return this._age - 10
    }

    set age(age: number) {
        this._age = age + 3
    }
}

const dajiao = new XiaoJieJie(28)

console.log(dajiao.age)

dajiao.age = 25

console.log(dajiao.age)

class Girl {
    // 静态方法可以在不建立实例的情况下直接调用
    static sayLove(): string {
        return 'I love you'
    }
}

console.log(Girl.sayLove())
